package com.zhuss.team.processor;

import com.zhuss.bean.bo.team.information.SearchInfoSonBo;
import com.zhuss.bean.vo.team.information.ListInfoSonVo;
import com.zhuss.common.PageVo;
import com.zhuss.enums.InfoSonStatus;
import com.zhuss.exception.WpsException;
import com.zhuss.team.db.dao.ext.InformationSonDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: zhushanshuo
 * @Date: 2020/3/4 14:42
 */
@Component("informationSonRead")
public class InformationSonRead {

    @Autowired
    private InformationSonDao informationSonDao;

    /**
     * 获取信息待阅列表
     * @return
     */
    public Object stayList(SearchInfoSonBo bo) {
        PageVo<ListInfoSonVo> result = new PageVo<ListInfoSonVo>();
        bo.setStatus(InfoSonStatus.待阅读.key());
        result.setPageNum(bo.getPageNum());
        result.setPageSize(bo.getPageSize());
        result.setItems(informationSonDao.listStay(bo));
        result.setTotal(informationSonDao.countStay(bo));
        return result;
    }

    /**
     * 获取信息已阅列表
     * @return
     */
    public Object alreadyList(SearchInfoSonBo bo) {
        PageVo<ListInfoSonVo> result = new PageVo<ListInfoSonVo>();
        bo.setStatus(InfoSonStatus.已阅读.key());
        result.setPageNum(bo.getPageNum());
        result.setPageSize(bo.getPageSize());
        result.setItems(informationSonDao.listAlready(bo));
        result.setTotal(informationSonDao.countAlready(bo));
        return result;
    }

    /**
     * 用户详情
     * @param infoId
     * @throws WpsException
     */
    public Object detail(Long infoId) throws WpsException {
//        Object result = informationDao.detail(infoId);
//        if (result == null) {
//            throw new WpsException(ExceptionCode.数据不存在);
//        }
//        return result;
        return null;
    }
}
